#include "widget.h"
#include "ui_widget.h"
#include<QIcon>
Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
    //创建对应的qrc文件
    QIcon rose(":/rose.png");//:作为开头,表⽰从qrc中读取资源,/是上⾯配置的前缀,添加的文件必须是在qrc文件的同级目录, 或者同级⽬录的⼦⽬录中
    this->setWindowIcon(rose);
}

Widget::~Widget()
{
    delete ui;
}

void Widget::on_pushButton_add_clicked()
{
    float opacity=this->windowOpacity();//取值范围0-1.0;0完全透明
    if(opacity>=1.0)return;
    opacity+=0.1;
    this->setWindowOpacity(opacity);
}


void Widget::on_pushButton_sub_clicked()
{
    float opacity=this->windowOpacity();
    if(opacity==0.0)return;
    opacity-=0.1;
    this->setWindowOpacity(opacity);
}

